#!/usr/bin/env bash

export GOROOT=~/.nextide/user_data/SDKs/go
export GOBIN=$GOROOT/bin
export GOARCH=amd64
export GOOS=linux
export PATH=.:$PATH:$GOBIN

if [ ! -f make.sh ]; then
echo 'make must be run within its container folder' 1>&2
exit 1
fi

CURDIR=`pwd`
OLDGOPATH="$GOPATH"
export GOPATH="$CURDIR"

gofmt -tabs=false -tabwidth=4 -w src

go install medusa
go install log
go install unit
go install msgcode
go install errcode

go install GateServer

export GOPATH="$OLDGOPATH"

echo 'finished'
